Optimal. Leaf size=75 \[ \frac {x}{b^2}-\frac {(2 a-b) \sqrt {a+b} \tan ^{-1}\left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{2 a^{3/2} b^2}+\frac {(a+b) \tan (x)}{2 a b \left (a+(a+b) \tan ^2(x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3270, 425, 536,
209, 211} \begin {gather*} -\frac {(2 a-b) \sqrt {a+b} \text {ArcTan}\left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{2 a^{3/2} b^2}+\frac {(a+b) \tan (x)}{2 a b \left ((a+b) \tan ^2(x)+a\right )}+\frac {x}{b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 211
Rule 425
Rule 536
Rule 3270
Rubi steps
\begin {align*} \int \frac {\cos ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx &=\text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \left (a+(a+b) x^2\right )^2} \, dx,x,\tan (x)\right )\\ &=\frac {(a+b) \tan (x)}{2 a b \left (a+(a+b) \tan ^2(x)\right )}-\frac {\text {Subst}\left (\int \frac {a-b+(-a-b) x^2}{\left (1+x^2\right ) \left (a+(a+b) x^2\right )} \, dx,x,\tan (x)\right )}{2 a b}\\ &=\frac {(a+b) \tan (x)}{2 a b \left (a+(a+b) \tan ^2(x)\right )}+\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (x)\right )}{b^2}-\frac {((2 a-b) (a+b)) \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\tan (x)\right )}{2 a b^2}\\ &=\frac {x}{b^2}-\frac {(2 a-b) \sqrt {a+b} \tan ^{-1}\left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{2 a^{3/2} b^2}+\frac {(a+b) \tan (x)}{2 a b \left (a+(a+b) \tan ^2(x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.24, size = 79, normalized size = 1.05 \begin {gather*} \frac {2 x+\frac {\left (-2 a^2-a b+b^2\right ) \tan ^{-1}\left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {b (a+b) \sin (2 x)}{a (2 a+b-b \cos (2 x))}}{2 b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.28, size = 75, normalized size = 1.00
method | result | size |
default | \(-\frac {\left (a +b \right ) \left (-\frac {b \tan \left (x \right )}{2 a \left (a \left (\tan ^{2}\left (x \right )\right )+b \left (\tan ^{2}\left (x \right )\right )+a \right )}+\frac {\left (2 a -b \right ) \arctan \left (\frac {\left (a +b \right ) \tan \left (x \right )}{\sqrt {a \left (a +b \right )}}\right )}{2 a \sqrt {a \left (a +b \right )}}\right )}{b^{2}}+\frac {\arctan \left (\tan \left (x \right )\right )}{b^{2}}\) | \(75\) |
risch | \(\frac {x}{b^{2}}-\frac {i \left (2 \,{\mathrm e}^{2 i x} a^{2}+3 b \,{\mathrm e}^{2 i x} a +b^{2} {\mathrm e}^{2 i x}-a b -b^{2}\right )}{a \,b^{2} \left (-b \,{\mathrm e}^{4 i x}+4 a \,{\mathrm e}^{2 i x}+2 b \,{\mathrm e}^{2 i x}-b \right )}+\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-a \left (a +b \right )}+2 a +b}{b}\right )}{2 a \,b^{2}}-\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-a \left (a +b \right )}+2 a +b}{b}\right )}{4 a^{2} b}-\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-a \left (a +b \right )}-2 a -b}{b}\right )}{2 a \,b^{2}}+\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-a \left (a +b \right )}-2 a -b}{b}\right )}{4 a^{2} b}\) | \(262\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 80, normalized size = 1.07 \begin {gather*} \frac {{\left (a + b\right )} \tan \left (x\right )}{2 \, {\left (a^{2} b + {\left (a^{2} b + a b^{2}\right )} \tan \left (x\right )^{2}\right )}} + \frac {x}{b^{2}} - \frac {{\left (2 \, a^{2} + a b - b^{2}\right )} \arctan \left (\frac {{\left (a + b\right )} \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{2 \, \sqrt {{\left (a + b\right )} a} a b^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 141 vs.
\(2 (63) = 126\).
time = 0.45, size = 367, normalized size = 4.89 \begin {gather*} \left [\frac {8 \, a b x \cos \left (x\right )^{2} - 4 \, {\left (a b + b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) - {\left ({\left (2 \, a b - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - a b + b^{2}\right )} \sqrt {-\frac {a + b}{a}} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 5 \, a b + b^{2}\right )} \cos \left (x\right )^{2} - 4 \, {\left ({\left (2 \, a^{2} + a b\right )} \cos \left (x\right )^{3} - {\left (a^{2} + a b\right )} \cos \left (x\right )\right )} \sqrt {-\frac {a + b}{a}} \sin \left (x\right ) + a^{2} + 2 \, a b + b^{2}}{b^{2} \cos \left (x\right )^{4} - 2 \, {\left (a b + b^{2}\right )} \cos \left (x\right )^{2} + a^{2} + 2 \, a b + b^{2}}\right ) - 8 \, {\left (a^{2} + a b\right )} x}{8 \, {\left (a b^{3} \cos \left (x\right )^{2} - a^{2} b^{2} - a b^{3}\right )}}, \frac {4 \, a b x \cos \left (x\right )^{2} - 2 \, {\left (a b + b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) + {\left ({\left (2 \, a b - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - a b + b^{2}\right )} \sqrt {\frac {a + b}{a}} \arctan \left (\frac {{\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a - b\right )} \sqrt {\frac {a + b}{a}}}{2 \, {\left (a + b\right )} \cos \left (x\right ) \sin \left (x\right )}\right ) - 4 \, {\left (a^{2} + a b\right )} x}{4 \, {\left (a b^{3} \cos \left (x\right )^{2} - a^{2} b^{2} - a b^{3}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 109, normalized size = 1.45 \begin {gather*} \frac {x}{b^{2}} - \frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac {a \tan \left (x\right ) + b \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )} {\left (2 \, a^{2} + a b - b^{2}\right )}}{2 \, \sqrt {a^{2} + a b} a b^{2}} + \frac {a \tan \left (x\right ) + b \tan \left (x\right )}{2 \, {\left (a \tan \left (x\right )^{2} + b \tan \left (x\right )^{2} + a\right )} a b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.33, size = 533, normalized size = 7.11 \begin {gather*} \frac {\mathrm {atan}\left (\frac {5\,\mathrm {tan}\left (x\right )}{2\,\left (\frac {3\,a}{2\,b}+\frac {b}{2\,a}-\frac {b^2}{2\,a^2}+\frac {5}{2}\right )}+\frac {\mathrm {tan}\left (x\right )}{2\,\left (\frac {5\,a}{2\,b}-\frac {b}{2\,a}+\frac {3\,a^2}{2\,b^2}+\frac {1}{2}\right )}+\frac {3\,a\,\mathrm {tan}\left (x\right )}{2\,\left (\frac {3\,a}{2}+\frac {5\,b}{2}+\frac {b^2}{2\,a}-\frac {b^3}{2\,a^2}\right )}-\frac {b\,\mathrm {tan}\left (x\right )}{2\,\left (\frac {a}{2}-\frac {b}{2}+\frac {5\,a^2}{2\,b}+\frac {3\,a^3}{2\,b^2}\right )}\right )}{b^2}+\frac {\mathrm {atanh}\left (\frac {\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{a^2-\frac {3\,a\,b}{2}-\frac {b^2}{2}+\frac {b^3}{4\,a}+\frac {13\,a^3}{4\,b}+\frac {3\,a^4}{2\,b^2}}+\frac {3\,\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{2\,\left (\frac {13\,a\,b}{4}+\frac {3\,a^2}{2}+b^2-\frac {3\,b^3}{2\,a}-\frac {b^4}{2\,a^2}+\frac {b^5}{4\,a^3}\right )}+\frac {13\,\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{4\,\left (a\,b+\frac {13\,a^2}{4}-\frac {3\,b^2}{2}-\frac {b^3}{2\,a}+\frac {3\,a^3}{2\,b}+\frac {b^4}{4\,a^2}\right )}-\frac {3\,b\,\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{2\,\left (a^3-\frac {3\,a^2\,b}{2}-\frac {a\,b^2}{2}+\frac {b^3}{4}+\frac {13\,a^4}{4\,b}+\frac {3\,a^5}{2\,b^2}\right )}-\frac {b^2\,\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{2\,\left (\frac {a\,b^3}{4}-\frac {3\,a^3\,b}{2}+a^4-\frac {a^2\,b^2}{2}+\frac {13\,a^5}{4\,b}+\frac {3\,a^6}{2\,b^2}\right )}+\frac {b^3\,\mathrm {tan}\left (x\right )\,\sqrt {-a^4-b\,a^3}}{4\,\left (a^5-\frac {3\,a^4\,b}{2}+\frac {a^2\,b^3}{4}-\frac {a^3\,b^2}{2}+\frac {13\,a^6}{4\,b}+\frac {3\,a^7}{2\,b^2}\right )}\right )\,\sqrt {-a^3\,\left (a+b\right )}\,\left (2\,a-b\right )}{2\,a^3\,b^2}+\frac {\mathrm {tan}\left (x\right )\,\left (a+b\right )}{2\,a\,b\,\left (\left (a+b\right )\,{\mathrm {tan}\left (x\right )}^2+a\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________